<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../plugins/axios.min.js"></script>
    <script src="../plugins/vue.min.js"></script>
</head>
<body>
    <div id="box">
       <button @click="getMessage">fetch</button>

       <ul>
        <li v-for="item in dataList">
            <!-- 相当于是item是原数据,然后进行了加工,myFilter是第一步骤,myFilter2是第二步还可以有后续步骤 -->
            <img :src="item | myFilter"/>
        </li>
       </ul>


    </div>
    <script>
        Vue.filter("myFilter",(url)=>{
            console.log('data====>',url)
            return "111"
        })
        let vm = new Vue({
            el:"#box",
            data:{
                myUsername:'huhu',
                dataList:[]
                },
                methods:{
                    getMessage(){
                        axios.get('./0-test.json').then(res=>{
                            // 光打印res可以看到所有的一些东西,请求头,状态码,data才是数据
                            console.log(res.data)
                            this.dataList = res.data
                        })
                    }
                }    
        })
    </script>
</body>
</html>